package com.suixingpay.demo.controller;

import com.suixingpay.demo.entity.KunpengOneUser;
import com.suixingpay.demo.service.KunpengOneUserService;
import com.suixingpay.demo.utils.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * one-one
 */

@RestController
@RequestMapping("/user")
public class KunpengOneUserController {

    @Autowired
    private KunpengOneUserService userService;

    @RequestMapping("select-all")
    public String selectAll() {
        return JacksonUtil.build(userService.selectAll());
    }

    @RequestMapping("insert-one")
    public String insertOne(KunpengOneUser kunpengOneUser){
        String str = userService.insertOne(kunpengOneUser);
        if ("success".equals(str)){
            return "添加成功，正在审核...";
        }else {
            return str;
        }
    }

    @RequestMapping("work-order-num")
    public Object workOrderNum(){
        return JacksonUtil.build(userService.workOrderNum());
    }

    @RequestMapping("select-father-area-num")
    public Object selectFatherAreaNum(String fatherAreaNum){
        return userService.selectFatherAreaNum(fatherAreaNum);
    }

    @RequestMapping("select-father-area-num-a")
    public Object selectFatherAreaNumA(String fatherAreaNum){
        return userService.selectFatherAreaNumA(fatherAreaNum);
    }

    @RequestMapping("select-one-all")
    public Object selectOneAll(String workOrderNum){
        return JacksonUtil.build(userService.selectOneAll(workOrderNum));
    }
}